import Vue from 'vue'
import VueRouter from 'vue-router'
// 1.引入自定义组件
import HomeView from '../views/HomeView.vue'
import hotSongs from '../components/hot/hotSongs.vue'
import recommendMusic from '../components/recommend/recommendMusic.vue'
import searchMusic from '../components/search/searchMusic.vue'
import songList from "../components/recommend/songList.vue" //歌单列表
import playMusic from "../components/untils/playMusic.vue"//播放界面

Vue.use(VueRouter)

//2. 定义路由
const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView,
    children: [
      {
        path: '/reconmend',
        name: 'reconmend',
        component: recommendMusic,

      },
      {
        path: '/hot',
        name: 'hot',
        component: hotSongs
      },
      {
        path: '/search',
        name: 'search',
        component: searchMusic
      },]

  }, {
    path: '/songList/:id',
    name: 'songList',
    component: songList
  }, {
    path: '/playMuscic/:id',
    name: 'playMuscic',
    component: playMusic
  }
  ,


]
// 3. 创建 router 实例，然后传 `routes` 配置
const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
